// 暴露方法，引入utilrequest
import { update } from "lodash"
import { request } from "../util/request.js"

export default {
    // 获取电影数据
    get: async () => {
        return await request({
            type: "get",
            url: "/api/cinemas",
        })
    },
    add: async data => await request({
        type: "POST",
        url: "/api/cinemas",
        data: data
    }),
    getAll: async () => {
        return await request({
            type: "get",
            url: '/api/cinemas/all',
        })
    },
    update: async data => {
        return await request({
            type: "PUT",
            url: `/api/cinemas/${data._id}`,
            data: data

        })
    },
    updateStatus: async data => {
        return await request({
            type: "patch",
            url: `/api/cinemas/updateStatus`,
            data
        })
    },
    delete: async ({ _id }) => {
        console.log(1111);
        return await request({
            type: "DELETE",
            url: `/api/cinemas/${_id}`,
        })
    }
}